import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Calendar;
import java.util.Random;

public class TestCaseGenerator {

	public static void main(String argc[]) {
		// input file formate:
		// TestCaseName Shape Size Parity GuessedShape CalculatedSize
		// CalculatedParity\
		// Separated by \t
		// TestCaseName: String
		// Shape: Line, Circle, Ellipse, Equilateral, Isosceles, Scalene,
		// Square, Rectangle
		// Size: Large(perimeter > 100), Small
		// Parity: Yes(Even), No
		// GuessedShape: Shape + InvalidTriangle, InvalidQuadrilateral
		// CalculatedSize: Large, Small
		// CalculatedParity: Yes(Even), No(Odd)

		// output:
		// junit test cases (copy source code from Console output)

		// files: 2wise.txt, 3wise.txt generated form
		// Test1ValidClassificationTree.cte
		// String inputfilename = "3wise.txt";
		String inputfilename = "3wise.txt";

		TestCaseGenerator gen = new TestCaseGenerator();

		try {
			BufferedReader file = new BufferedReader(new InputStreamReader(
					new FileInputStream(inputfilename)));

			String line;
			while ((line = file.readLine()) != null) {
				String[] tokens = line.split("\t");
				System.out.print(gen.generateTestCase(tokens[0].trim(), // test
																		// case
																		// name
						tokens[1].trim(), // shape
						tokens[2].trim(), // size
						tokens[3].trim(), // parity
						tokens[4].trim(), // guessedShape
						tokens[5].trim(), // calculatedSize
						tokens[6].trim() // calculatedParity
						));
			}
		} catch (Exception e) {

		} finally {
		}
	}

	private Random rnd = new Random(Calendar.getInstance().getTimeInMillis());

	public String generateTestCase(String testCaseName, String shape,
			String size, String parity, String guessedShape,
			String calculatedSize, String calculatedParity) {

		String input = null;
		String expectedOutput = null;

		int badGuesses = 0;
		boolean need_comma = false;

		int[] parameters = null;

		if (!checkShape(shape) || !checkSize(size) || !checkParity(parity)
				|| !checkGuessedShape(guessedShape)
				|| !checkSize(calculatedSize) || !checkParity(calculatedParity)) {
			return null;
		}

		input = shape + "," + size + "," + parity;

		if (shape.equals(guessedShape) && size.equals(calculatedSize)
				&& parity.equals(calculatedParity)) {
			expectedOutput = "Yes: ";
		} else {
			expectedOutput = "No: ";
		}

		if (!shape.equals(guessedShape)) {
			if (guessedShape.equals("InvalidTriangle1")
					|| guessedShape.equals("InvalidTriangle2")
					|| guessedShape.equals("InvalidTriangle3")) {

				expectedOutput += "Suggestion=Not A Triangle";

			} else if (guessedShape.equals("InvalidQuadrilateral")) {

				expectedOutput += "Suggestion=Not A Rectangle";

			} else {

				expectedOutput += "Suggestion=" + guessedShape;

			}

			need_comma = true;
			badGuesses++;
		}

		if (!size.equals(calculatedSize)) {

			if (need_comma) {

				expectedOutput += ", ";

			}

			expectedOutput += "Wrong Size";
			need_comma = true;
			badGuesses++;
		}

		if (!parity.equals(calculatedParity)) {

			if (need_comma) {
				expectedOutput += ", ";
			}

			expectedOutput += "Wrong Even/Odd";
			badGuesses++;
		}

		if (badGuesses == 3) {

			expectedOutput = "Bad guess limit Exceeded";

		}

		// generate parameters a, b, c, d for test cases
		boolean isLarge = calculatedSize.equals("Large");
		boolean isEven = calculatedParity.equals("Yes");

		if (guessedShape.equals("Line")) {
			parameters = generateLine(isLarge, isEven);
		} else if (guessedShape.equals("Circle")) {
			parameters = generateCircle(isLarge, isEven);
		} else if (guessedShape.equals("Ellipse")) {
			parameters = generateEllipse(isLarge, isEven);
		} else if (guessedShape.equals("Equilateral")) {
			parameters = generateEquilateral(isLarge, isEven);
		} else if (guessedShape.equals("Isosceles1")) {
			parameters = generateIsosceles1(isLarge, isEven);
		} else if (guessedShape.equals("Isosceles2")) {
			parameters = generateIsosceles2(isLarge, isEven);
		} else if (guessedShape.equals("Isosceles3")) {
			parameters = generateIsosceles3(isLarge, isEven);
		} else if (guessedShape.equals("Scalene")) {
			parameters = generateScalene(isLarge, isEven);
		} else if (guessedShape.equals("InvalidTriangle1")) {
			parameters = generateInvalidTriangle1(isLarge, isEven);
		} else if (guessedShape.equals("InvalidTriangle2")) {
			parameters = generateInvalidTriangle2(isLarge, isEven);
		} else if (guessedShape.equals("InvalidTriangle3")) {
			parameters = generateInvalidTriangle3(isLarge, isEven);
		} else if (guessedShape.equals("Square")) {
			parameters = generateSquare(isLarge, isEven);
		} else if (guessedShape.equals("Rectangle")) {
			parameters = generateRectangle(isLarge, isEven);
		} else if (guessedShape.equals("InvalidQuadrilateral")) {
			parameters = generateInvalidQuadrilateral(isLarge, isEven);
		}

		for (int i = 0; i < parameters.length; ++i) {
			input = input + "," + parameters[i];
		}

		return "@Test\n"
				+ ""
				+ "public void test_"
				+ testCaseName
				+ "() {\n"
				+ "System.out.println(\"======================== Test Case "
				+ testCaseName
				+ " ========================\\n\");\n"
				+ "System.out.println(\"Input: ["
				+ input
				+ "]\\n\");\n"
				+ "System.out.println(\"Expected Output: ["
				+ expectedOutput
				+ "]\\n\");\n"
				+ "assertEquals(\"Check \", \"" + expectedOutput
				+ "\", c.evaluateGuess(\"" + input + "\"));\n" + "}\n";
	}

	private int[] generateLine(boolean isLarge, boolean isEven) {

		int[] retval = new int[1];
		int a = 0;

		if (isLarge) {
			// a = 101 ... 4094
			a = rnd.nextInt(4095 - 101) + 101;
		} else {
			// a = 1 ... 100
			a = rnd.nextInt(100) + 1;
		}

		if (isEven) {
			a = Math.round(a / 2) * 2;
		} else {
			a = Math.round(a / 2) * 2 + 1;
		}

		assert a >= 1 && a <= 4095;
		assert (isLarge && a > 100) || (!isLarge && a <= 100);

		retval[0] = a;

		return retval;
	}

	private int[] generateCircle(boolean isLarge, boolean isEven) {
		int[] retval = new int[2];
		int a = 0;

		if (isLarge) {
			// 16...4094
			a = rnd.nextInt(4095 - 16) + 16;
		} else {
			// 1...15
			a = rnd.nextInt(15) + 1;
		}

		if (isEven) {
			a = Math.round(a / 2) * 2;
		} else {
			a = Math.round(a / 2) * 2 + 1;
		}

		assert a >= 1 && a <= 4095;
		assert (isLarge && a >= 16) || (!isLarge && a < 16);

		retval[0] = a;
		retval[1] = a;

		return retval;
	}

	private int[] generateEllipse(boolean isLarge, boolean isEven) {

		int[] retval = new int[2];

		int a = 0;
		int b = 0;
		
		double perimeter = 0;
		int product = 0;

		while (true) {

			a = (int) (rnd.nextDouble() * 4095);
			b = (int) (rnd.nextDouble() * 4095);

			perimeter = Math.PI
					* (3 * (a + b) - Math.sqrt((3 * a + b) * (a + 3 * b)));
			
			double ratio = 1;

			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble()
							* (4095 / Math.max(a, b) - 100 / perimeter) + 100
							/ perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
			}

			perimeter = Math.PI
					* (3 * (a + b) - Math.sqrt((3 * a + b) * (a + 3 * b)));
			product = (a%2) * (b%2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product != 0) || (!isEven && product == 0)) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;

		return retval;
	}

	private int[] generateEquilateral(boolean isLarge, boolean isEven) {
		int[] retval = new int[3];
		int a = 0;

		if (isLarge) {
			a = rnd.nextInt(4096 - 34) + 34;
		} else {
			a = rnd.nextInt(33) + 1;
		}

		if (isEven) {
			a = Math.round(a / 2) * 2;
		} else {
			a = Math.round(a / 2) * 2 + 1;
		}

		assert (isLarge && a > 33 && a <= 4095)
				|| (!isLarge && a >= 1 && a <= 33);

		retval[0] = a;
		retval[1] = a;
		retval[2] = a;

		return retval;
	}

	private int[] generateIsosceles1(boolean isLarge, boolean isEven) {
		// a == b
		int[] retval = new int[3];
		
		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;
		
		while (true) {

			if (isLarge) {
				a = rnd.nextInt(4096 - 26) + 26;
				b = a;
				c = rnd.nextInt(Math.min(2 * a - 1, 4095)) + 1;
			} else {
				a = rnd.nextInt(49) + 1;
				b = a;
				c = rnd.nextInt(Math.min(2 * a - 1, 100 - 2 * a - 1)) + 1;
			}

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = a;
				c = Math.round(c / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || !isLarge && perimeter > 100) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a + b <= c || b + c <= a || c + a <= b) {
				continue;
			}
			if (c == a || b != a || b == c) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateIsosceles2(boolean isLarge, boolean isEven) {
		// b == c
		int[] retval = new int[3];
		
		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;
		
		while (true) {

			if (isLarge) {
				b = rnd.nextInt(4096 - 26) + 26;
				c = b;
				a = rnd.nextInt(Math.min(2 * b - 1, 4095)) + 1;
			} else {
				b = rnd.nextInt(49) + 1;
				c = b;
				a = rnd.nextInt(Math.min(2 * b - 1, 100 - 2 * b - 1)) + 1;
			}

			if (!isEven) {
				b = Math.round(b / 2) * 2 + 1;
				c = b;
				a = Math.round(a / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || !isLarge && perimeter > 100) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a + b <= c || b + c <= a || c + a <= b) {
				continue;
			}
			if (c == a || b == a || b != c) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateIsosceles3(boolean isLarge, boolean isEven) {
		// a == c
		int[] retval = new int[3];
		
		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;
		
		while (true) {

			if (isLarge) {
				c = rnd.nextInt(4096 - 26) + 26;
				a = c;
				b = rnd.nextInt(Math.min(2 * c - 1, 4095)) + 1;
			} else {
				c = rnd.nextInt(49) + 1;
				a = c;
				b = rnd.nextInt(Math.min(2 * c - 1, 100 - 2 * c - 1)) + 1;
			}

			if (!isEven) {
				c = Math.round(a / 2) * 2 + 1;
				a = c;
				b = Math.round(b / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || !isLarge && perimeter > 100) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a + b <= c || b + c <= a || c + a <= b) {
				continue;
			}
			if (c != a || b == a || b == c) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateScalene(boolean isLarge, boolean isEven) {
		int[] retval = new int[3];

		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;

		while (true) {
			a = (int) (rnd.nextDouble() * 4095);
			b = (int) (rnd.nextDouble() * 4095);
			c = (int) (rnd.nextDouble() * (a + b - Math.max(a, b) + Math.min(a, b))
					+ Math.max(a, b) - Math.min(a, b));

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);
			
			double ratio = 1;

			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble()
							* (4095 / Math.max(Math.max(a, b), c) - 100 / perimeter)
							+ 100 / perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);
			c = (int) (c * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
				c = Math.round(c / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || !isLarge && perimeter > 100) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a + b <= c || b + c <= a || c + a <= b) {
				continue;
			}
			if (a == b || b == c || c == a ) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateInvalidTriangle1(boolean isLarge, boolean isEven) {
		// a + b <= c
		int[] retval = new int[3];

		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;

		while (true) {
			a = (int) (rnd.nextDouble() * 4095);
			b = (int) (rnd.nextDouble() * 4095);
			if (a + b > 4095) {
				continue;
			}
			c = (int) (rnd.nextDouble() * (4095 - a - b) + a + b);

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);
			
			double ratio = 1;

			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble() * (4095 / c - 100 / perimeter)
							+ 100 / perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);
			c = (int) (c * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
				c = Math.round(c / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a + b > c) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateInvalidTriangle2(boolean isLarge, boolean isEven) {
		// b + c <= a
		int[] retval = new int[3];

		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;

		while (true) {
			b = (int) (rnd.nextDouble() * 4095);
			c = (int) (rnd.nextDouble() * 4095);
			if (b + c > 4095) {
				continue;
			}
			a = (int) (rnd.nextDouble() * (4095 - b - c) + b + c);

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);
			
			double ratio = 1;

			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble() * (4095 / a - 100 / perimeter)
							+ 100 / perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);
			c = (int) (c * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
				c = Math.round(c / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (b + c > a) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateInvalidTriangle3(boolean isLarge, boolean isEven) {
		// c + a <= b
		int[] retval = new int[3];

		int a = 0;
		int b = 0;
		int c = 0;
		
		int perimeter = 0;
		int product = 0;

		while (true) {
			c = (int) (rnd.nextDouble() * 4095);
			a = (int) (rnd.nextDouble() * 4095);
			if (c + a > 4095) {
				continue;
			}
			b = (int) (rnd.nextDouble() * (4095 - c - a) + c + a);

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			double ratio = 1;
			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble() * (4095 / b - 100 / perimeter)
							+ 100 / perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);
			c = (int) (c * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
				c = Math.round(c / 2) * 2 + 1;
			}

			perimeter = a + b + c;
			product = (a % 2) * (b % 2) * (c % 2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (c + a > b) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;

		return retval;
	}

	private int[] generateSquare(boolean isLarge, boolean isEven) {

		int[] retval = new int[4];

		int a = 0;
		int perimeter = 0;
		int product = 0;

		while (true) {
			if (isLarge) {
				a = rnd.nextInt(4096 - 26) + 26;
			} else {
				a = rnd.nextInt(25) + 1;
			}
			if (isEven) {
				a = Math.round(a / 2) * 2;
			} else {
				a = Math.round(a / 2) * 2 + 1;
			}

			perimeter = 4 * a;
			product = a % 2;

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a < 1 || a > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = a;
		retval[2] = a;
		retval[3] = a;

		return retval;
	}

	private int[] generateRectangle(boolean isLarge, boolean isEven) {

		int[] retval = new int[4];

		int a = 0;
		int b = 0;

		int perimeter = 0;
		int product = 0;

		while (true) {
			a = (int) (rnd.nextDouble() * 4095);
			b = (int) (rnd.nextDouble() * 4095);
			
			perimeter = 2 * (a + b);
			double ratio = 1;
			
			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble()
							* (4095 / Math.max(a, b) - 100 / perimeter) + 100
							/ perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}
			
			a = (int) (a * ratio);
			b = (int) (b * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
			}

			perimeter = 2 * (a + b);
			product = (a % 2) * (b % 2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = a;
		retval[3] = b;

		return retval;
	}

	private int[] generateInvalidQuadrilateral(boolean isLarge, boolean isEven) {

		int[] retval = new int[4];

		int a = 0;
		int b = 0;
		int c = 0;
		int d = 0;

		int perimeter = 0;
		int product = 0;

		while (true) {
			a = (int) (rnd.nextDouble() * 4095);
			b = (int) (rnd.nextDouble() * 4095);
			c = (int) (rnd.nextDouble() * 4095);
			d = (int) (rnd.nextDouble() * 4095);

			perimeter = a + b + c + d;

			double ratio = 1;
			if (isLarge) {
				if (perimeter <= 100) {
					ratio = rnd.nextDouble()
							* (4095 / Math.max(Math.max(a, b), Math.max(c, d)) - 100 / perimeter)
							+ 100 / perimeter;
				}
			} else {
				if (perimeter > 100) {
					ratio = rnd.nextDouble() * 100 / perimeter;
				}
			}

			a = (int) (a * ratio);
			b = (int) (b * ratio);
			c = (int) (c * ratio);
			d = (int) (d * ratio);

			if (!isEven) {
				a = Math.round(a / 2) * 2 + 1;
				b = Math.round(b / 2) * 2 + 1;
				c = Math.round(c / 2) * 2 + 1;
				d = Math.round(d / 2) * 2 + 1;
			}

			perimeter = (a + b + c + d);
			product = (a % 2) * (b % 2) * (c % 2) * (d % 2);

			if ((isLarge && perimeter <= 100) || (!isLarge && perimeter > 100)) {
				continue;
			}
			if ((isEven && product % 2 == 1) || (!isEven && product % 2 == 0)) {
				continue;
			}
			if (a == c && b == d) {
				continue;
			}
			if (a < 1 || a > 4095 || b < 1 || b > 4095 || c < 1 || c > 4095
					|| d < 1 || d > 4095) {
				continue;
			}
			break;
		}

		retval[0] = a;
		retval[1] = b;
		retval[2] = c;
		retval[3] = d;

		return retval;
	}

	private boolean checkGuessedShape(String guessedShape) {
		if (checkShape(guessedShape)) {
			return true;
		} else {
			if (guessedShape.equals("InvalidEllipse")
					|| guessedShape.equals("Isosceles1")
					|| guessedShape.equals("Isosceles2")
					|| guessedShape.equals("Isosceles3")
					|| guessedShape.equals("InvalidTriangle1")
					|| guessedShape.equals("InvalidTriangle2")
					|| guessedShape.equals("InvalidTriangle3")
					|| guessedShape.equals("InvalidQuadrilateral")) {
				return true;
			} else {
				return false;
			}
		}
	}

	private boolean checkParity(String parity) {
		if (parity == null) {
			return false;
		}

		if (parity.equals("Yes") || parity.equals("No")) {
			return true;
		} else {
			return false;
		}
	}

	private boolean checkSize(String size) {
		if (size == null) {
			return false;
		}

		if (size.equals("Large") || size.equals("Small")) {
			return true;
		} else {
			return false;
		}
	}

	private boolean checkShape(String shape) {

		if (shape == null) {
			return false;
		}

		if (shape.equals("Line") || shape.equals("Circle")
				|| shape.equals("Ellipse") || shape.equals("Equilateral")
				|| shape.equals("Isosceles") || shape.equals("Scalene")
				|| shape.equals("Square") || shape.equals("Rectangle")) {
			return true;
		} else {
			return false;
		}
	}

}
